<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="com.blockchain.front.servlets.SendEmailCode"%>
<%@page import="com.blockchain.front.servlets.security.JymmVerify"%>
<%@page import="com.blockchain.front.servlets.security.JymmVerifyCode"%>
<%@page import="com.blockchain.front.servlets.security.WjJymm"%>
<%@page import="com.blockchain.front.servlets.password.ResetVerify"%>
<%@page import="com.blockchain.front.servlets.password.ResetExists"%>
<%@page import="com.blockchain.common.enums.IsPass"%>
<html>
<head>
<%
String str = languageDefine.getValue(request, "modifyTradePassword_modifyTradePassword");
String _TITLE_ = str + "- "+configureProvider.getProperty(SystemVariable.SITE_NAME);
CURRENT_SUB_CATEGORY="AQZX"; 
PC_TITLE_NAME="XGJYMA";
String message = request.getParameter("message");
%>
<title><%=_TITLE_ %></title>
<%@include file="/WEB-INF/include/meta.jsp"%>
<%@include file="/WEB-INF/include/style.jsp"%>
</head>
<%@include file="/WEB-INF/include/header.jsp"%>
<%@include file="/WEB-INF/include/authenticatedSession.jsp"%>
 <div class="autobox">
 <div class="now">
  <a href="<%=controller.getViewURI(request, com.blockchain.front.servlets.Index.class)%>" class="orange"><%=languageDefine.getValue(request, "menu_home")%></a>&gt; <a href="<%=controller.getViewURI(request, com.blockchain.front.servlets.security.index.class)%>" class="orange"><%=languageDefine.getValue(request, "menu_safeCenter")%></a> &gt; <%=languageDefine.getValue(request, "modifyTradePassword_modifyTradePassword")%>
 </div>
 <div class="assets_center clear po_re zin70">
 	<%@include file="/WEB-INF/include/aqzx/left.jsp"%>
  <div class="assets_content w900 right bg_w">
            <div class="safe_center clear" style="padding-left: 0px;">
                <h1 style="margin-top: 0px; margin-bottom: 15px; line-height: 15px;"><%=languageDefine.getValue(request, "forgetTradePassword_forgetTradePassword")%></h1>
            </div>
            <br/>
            <%String errorMessage = controller.getPrompt(request,response,PromptLevel.ERROR);%>
            <form action="<%=controller.getURI(request,WjJymm.class)%>" method="post" onsubmit="return onSubmit()">  
            <table class="jymmbox">
            <tbody>
            <tr>
                        <td>
                            <div class="com_warning" style="margin-bottom: 0;line-height:36px;"> 
                            <%StringHelper.filterHTML(out, null==errorMessage?"":(errorMessage.indexOf("err_")!=-1?languageDefine.getValue(request, errorMessage):errorMessage));%>
                            </div>
                            
                            <div class="com_warning" style="margin-bottom: 0;line-height:36px;"> 
                            <%StringHelper.filterHTML(out, null==message?"":message);%>
                            </div>
                        </td>
                    </tr>
                <tr>
                    <th><%=languageDefine.getValue(request, "forgetTradePassword_captcha")%>:</th>
                    <td><div class="formbody">
                            <i class="icon_code"></i>
                            <input maxlength="4" type="text" class="code" id="verify" onblur="txverifyCheck();"  name="txverifyCode"   placeholder='<%=languageDefine.getValue(request, "forgetTradePassword_enterVerificationCode")%>' style="width: 100px;">
                            <img id="codeImg" src="<%=controller.getURI(request, JymmVerify.class)%>" width="145" height="42" onclick="this.src='<%=controller.getURI(request, JymmVerify.class)%>?'+Math.random()" style="float: left; cursor: pointer;" title='<%=languageDefine.getValue(request, "forgetTradePassword_changeCaptcha")%>'>
                        </div></td>
                </tr>
                <tr>
                    <th><%=languageDefine.getValue(request, "forgetTradePassword_smsVerificationCode")%>：</th>
                    <td><div class="formbody">
                            <i class="icon_code"></i>
                            <input maxlength="4" type="text" class="code" id="moble_verify" name="dxverifyCode" onblur="dxverifyCheck();"  placeholder='<%=languageDefine.getValue(request, "forgetTradePassword_enterVerificationCode")%>' style="width: 100px;">
                            <input id="regBtn" type="button" class="getyzm" value='<%=languageDefine.getValue(request, "forgetTradePassword_getVerificationCode")%>' onclick="sendCode(this);" style="width: 142px;float:right; height: 42px;">
                        </div>
                        </td>
                </tr>
                <tr>
                    <th><%=languageDefine.getValue(request, "forgetTradePassword_newTradePassword")%>：</th>
                    <td><div class="formbody" style="width: 250px;">
                            <i class="icon_password"></i>
                            <input type="password" class="password" id="password" name="password"  onblur="passwordCheck()" placeholder='<%=languageDefine.getValue(request, "forgetTradePassword_passwordTip")%>' value="<%StringHelper.filterHTML(out,request.getParameter("password"));%>">
                        </div></td>
                </tr>
                <tr>
                    <th><%=languageDefine.getValue(request, "forgetTradePassword_tradePasswordAgain")%>：</th>
                    <td><div class="formbody" style="width: 250px;">
                            <i class="icon_password"></i>
                            <input type="password" class="password" id="repassword" name="newPassword" onblur="rePasswordCheck()" placeholder='<%=languageDefine.getValue(request, "forgetTradePassword_enterTradePasswordAgain")%>' value="<%StringHelper.filterHTML(out,request.getParameter("newPassword"));%>">
                        </div></td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td><div class="formbody">
                            <input type="submit" class="pocoins_btn" name="index_submit" id="Submin"  value='<%=languageDefine.getValue(request, "forgetTradePassword_getBackTradePassword")%>' style="width: 320px;">
                        </div></td>
                </tr>
            </tbody>
        </table>
        </form>
        </div>
 </div>
</div>
<%@include file="/WEB-INF/include/footer.jsp"%>
<%@include file="/WEB-INF/include/script.jsp"%>
<script type="text/javascript">

var _tx_url ='<%=controller.getURI(request,JymmVerifyCode.class)%>';
var _cUrl = '<%=controller.getURI(request, SendEmailCode.class)%>';

var phoneVal = /^(13|15|18|17|14|16|19)[0-9]{9}$/;
var emailVal = /^([0-9A-Za-z\-_\.]+)@([0-9a-z]+\.[a-z]{2,3}(\.[a-z]{2})?)$/;
var isNull = /^[\s]{0,}$/;
var verify = /^\d{4}$/;

function txverifyCheck() {
	var val = $("input[name='txverifyCode']").val();
	var p = $("#verify");
	if (isNull.test(val)) {
		layer.tips('<%=languageDefine.getValue(request, "js_captchaNotNull")%>', '#verify', {tips:3});
		return false;
	} else if (!verify.test(val)) {
		layer.tips('<%=languageDefine.getValue(request, "js_captchaError")%>', '#verify', {tips:3});
		return false;
	}
	return true;
}

function dxverifyCheck() {
	var val = $("input[name='dxverifyCode']").val();
	var p = $("#verify");
	if (isNull.test(val)) {
		layer.tips(_error_global.js_smsVerificationCodeNotNull, '#moble_verify', {tips:3});
		return false;
	} else if (!verify.test(val)) {
		layer.tips(_error_global.js_smsVerificationCodeError, '#moble_verify', {tips:3});
		return false;
	}
	return true;
}

var wait = 60;

function sendCode(evn){
	if(wait > 0 && wait < 60){
		return;
	}
	var tx = $("input[name='txverifyCode']").val();

	var p =$("#moble-msg"); 
	
	if (isNull.test(tx)) {
		layer.tips(_error_global.js_captchaNotNull, '#verify', {tips:3});
		return false;
	} else if (!verify.test(tx)) {
		layer.tips(_error_global.js_captchaError, '#verify', {tips:3});
		return false;
	}
	sendclick(evn);
	var datatx={"txverifyCode":tx};
	$.ajax({
		type:"post",
		dataType:"html",
		url:_tx_url,
		data:datatx,
		success:function(data){
			if(data==1){
			 	 var data={"type":"WJJYMM"};
				$.ajax({
					type:"post",
					dataType:"html",
					url:_cUrl,
					data:data,
					success:function(data){
						var ct = eval('('+data+')');
						if(ct.length>0){
							if(ct[0].num == "02"){
								
							} else {
								wait = 0;
								layer.tips(ct[0].msg, '#regBtn', {tips: 2});
							}
							return false;
						}
					}
				});  
			}else{	
				wait = 0;
				layer.tips(data, '#regBtn', {tips: 2}); 
				return false;
			} 
			}
	});
}

 function sendclick(evn){
	 var obj = $('#regBtn');
	 if (wait == 0) {
			obj.val('<%=languageDefine.getValue(request, "js_getCaptcha")%>');
            obj.css('backgroundColor', '#0d66bf');
			wait = 60;
		} else {
			 obj.css('backgroundColor', '#999B9C');
             obj.val(wait + '<%=languageDefine.getValue(request, "js_sendAgain")%>');
             wait--;
			setTimeout(function() {
				sendclick(evn);
			},
			1000);
		}
	}
 
 function passwordCheck() {
		var ipt = $("input[name='password']");
		var val = ipt.val();
		if (isNull.test(val)) {
			layer.tips('<%=languageDefine.getValue(request, "js_passwordCannotNull")%>', '#password', {tips:3});
			return false;
		} else if (val.length<6 || val.length >16) {
			layer.tips('<%=languageDefine.getValue(request, "js_passwordReg")%>', '#password', {tips:3});
			return false;
		}
		return true;
	}
 
 function rePasswordCheck() {
		var ipt = $("input[name='password']");
		var _ipt = $("input[name='newPassword']");
		var val = ipt.val();
		var _val = _ipt.val();
		if (isNull.test(ipt.val())) {
			layer.tips('<%=languageDefine.getValue(request, "js_enterNewTradePassword")%>', '#repassword', {tips:3});
			return false;
		} else if (isNull.test(_val)) {
			layer.tips('<%=languageDefine.getValue(request, "js_newTradePasswordAgain")%>', '#repassword', {tips:3});
			return false;
		} else if (_val != val) {
			layer.tips('<%=languageDefine.getValue(request, "js_TradePasswordNotSame")%>', '#repassword', {tips:3});
			return false;
		}
		return true;
	}
 
 function onSubmit()
 {
	
 	if (txverifyCheck()&&dxverifyCheck()&&passwordCheck()&&rePasswordCheck()){
 		return true;
 	}
 	return false;
 } 
</script>
</body>
</html>	
